package com.taxt.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.taxt.R;
import com.taxt.app.AppAdapter;
import com.taxt.http.api.HomeDataApi;
import com.taxt.http.model.HomeInfoBean;
import com.taxt.ui.activity.VideoSelectActivity;

import java.util.List;

/**
 *    author : wq

 *    time   : 2018/11/05
 *    desc   : 热点问题
 */
public final class HotPBusinessAdapter extends AppAdapter<HomeInfoBean.CommonBusinessDTO> {
    private final List<HomeInfoBean.CommonBusinessDTO> mSelectBusiness;
    public HotPBusinessAdapter(Context context,List<HomeInfoBean.CommonBusinessDTO> mSelectBusines) {
        super(context);
        this.mSelectBusiness=mSelectBusines;
    }


    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private TextView mHotProblemTx,mHotBusinessContent;
        private ImageView mTipsImg;
        private ViewHolder() {
            super(R.layout.hot_business_item);
            mHotProblemTx=findViewById(R.id.business_title);
            mHotBusinessContent=findViewById(R.id.business_content);
            mTipsImg=findViewById(R.id.tips_img);
        }

        @Override
        public void onBindView(int position) {
            HomeInfoBean.CommonBusinessDTO bean=getItem(position);
            mHotProblemTx.setText(bean.getTitle());
            mHotBusinessContent.setText(bean.getSubTitle());
            if(position==0){
                mTipsImg.setImageResource(R.mipmap.homepage_common_business_frame1);
            }else if(position==1){
                mTipsImg.setImageResource(R.mipmap.homepage_common_business_frame2);
            }else if(position==2){
                mTipsImg.setImageResource(R.mipmap.homepage_common_business_frame3);
            }else if(position==3){
                mTipsImg.setImageResource(R.mipmap.homepage_common_business_frame4);
            }
        }
    }
}